package com.study.bigdata.spark.core.rdd.operator.transform

import org.apache.spark.{SparkConf, SparkContext}

object Scala19_RDD_Operator_Transform{
  def main(args: Array[String]): Unit = {

    val conf = new SparkConf().setMaster("local[*]").setAppName("RDD")
    conf.set("spark.local.dir","D:\\hadoopbook\\spark\\test")
    val sc = new SparkContext(conf)
    // TODO 算子 - 转换 -  sortByKey

    val rdd = sc.makeRDD(List(("a",2),("a",1),("c",3),("b",4)))
    // TODO　sortByKey算子对key进行排序
    val rdd1 = rdd.sortByKey(/*false*/)

    rdd1.collect().foreach(println)
    /*
    (a,2)
    (a,1)
    (b,4)
    (c,3)
     */
    sc.stop()

  }

}
